package com.base.service;

import com.base.po.param.NetState;
import com.base.po.voip.SbdDetail;
import com.base.po.voip.SbdDetailExample;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

public interface SbdDetailService {
    int countByExample(SbdDetailExample example);

    int deleteByExample(SbdDetailExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(SbdDetail record);

    int insertSelective(SbdDetail record);

    List<SbdDetail> selectByExample(SbdDetailExample example);

    SbdDetail selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") SbdDetail record, @Param("example") SbdDetailExample example);

    int updateByExample(@Param("record") SbdDetail record, @Param("example") SbdDetailExample example);

    int updateByPrimaryKeySelective(SbdDetail record);

    int updateByPrimaryKey(SbdDetail record);
    
    /**
     *  @Date: 2020/9/16 15:08
     *  @Description:
     *  获取某个用户的某个statement的SBD值
     *  statement传入100即为查询全部
     */ 
    BigDecimal getSbdDetailMoney(String userId,Integer statement) throws RuntimeException;
    
    /**
     *  @Date: '2020/9/16' 15:17
     *  @Description:
     *  Sbd金额扣除时候必须调用此Service，进行扣除Sbd金额
     *  必填项：
     *     private String sbdUser;
     *     private String sbdTradeTo;
     *     private String sbdTradeContext;
     *     private BigDecimal sbdTradeMoney;
     *     private Integer sbdStatus;
     *     private Integer sbdStatement;
     */
    NetState delSbdDetailMoney(String sbdUser, String sbdTradeTo, String sbdTradeContext, BigDecimal sbdTradeMoney, Integer sbdStatus, Integer sbdStatement);

    List<SbdDetail> getDetailMoneyList(String userId, Integer statement, Integer pageNo);

    NetState transferMoney(String userId, String getMoneyUserId, BigDecimal money);

    Integer getDetailMoneyCount(String subId, Integer statement);
}
